<div id="userGuidModal" class="modal fade" tabindex="-1" data-width="400" data-backdrop="static" data-keyboard="false">
	<div class="modal-dialog">
		<div class="modal-content">

			<div class="modal-header">
				<h4 class="modal-title">您好，欢迎使用MQCloud</h4>
			</div>

			<!-- 用户信息补全 -->
			<form class="form-horizontal form-bordered form-row-stripped" id="updateUserGuideForm">
				<div class="modal-body">
					<div class="row">
						<div class="col-md-12">
							<div class="form-body">
								<div class="form-group">
									<label class="control-label col-md-3"> 邮箱: </label>
									<div class="col-md-5">
										<input type="text" name="email" readonly="readonly"
											value="${userInfo.loginId}" placeholder="邮箱"
											class="form-control" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-md-3"> 姓名: </label>
									<div class="col-md-5">
										<input type="text" name="name" id="username"
											value="" placeholder="姓名"
											class="form-control" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-md-3"> 手机: </label>
									<div class="col-md-5">
										<input type="text" name="mobile"
											value="" placeholder="手机"
											class="form-control" />
									</div>
								</div>
								<div class="form-group">
									<label class="control-label col-md-3"> 角色: </label>
									<div class="col-md-5">
										<select name="type" id="userType"
											class="form-control select2_category">
											<option value="1">
												管理员
											</option>
											<option value="0" selected="selected">
												普通用户
											</option>
										</select>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" onclick="updateUserGuideLater()" style="float:left;">我先看看，稍后完善</button>
					<button type="button" class="btn btn-primary" onclick="updateUserGuide()">确定</button>
				</div>
			</form>
		</div>
	</div>
</div>
<script>
$(function(){
	$("#userGuidModal").modal("show");
	$("#userType").change(function(){
		  if($(this).val() == 1){
			  if(!confirm("管理员权限需要审核，你确定需要成为管理员?")){
				  $(this).val(0); 
			  }
		  }
	});
})
function updateUserGuide(){
	$.post('${request.contextPath}/user/guide/update',
		$("#updateUserGuideForm").serialize(),
        function(data){
            if(data.status == 200){
				toastr.success("操作成功，系统将自动刷新");  
				setTimeout("toTopicList()",3000);
		    }else{
		    	toastr.error("操作失败！"+data.message);  
		    }
        }, 'json');
}
function updateUserGuideLater(){
	$.post('${request.contextPath}/user/guide/skip',
        function(data){
            if(data.status == 200){
				toastr.success("请稍后，系统将自动刷新");  
		        setTimeout("toTopicList()",3000);
		    }else{
		    	toastr.error("操作失败！"+data.message);  
		    }
        }, 'json');
}
function toTopicList(){
	window.location.href= "${request.contextPath}/user/topic";
}
</script>
